<template>
  <div class="set-goods">
    <head-nav :cname="titleName"></head-nav>
    <data-list></data-list>
    <el-table :data="setData" border>
      <el-table-column prop="id" label="编号" width="100"> </el-table-column>
      <el-table-column prop="timeName" label="秒杀时间段名称" width="180">
      </el-table-column>
      <el-table-column prop="startTime" label="每日开始时间" width="180">
      </el-table-column>
      <el-table-column prop="endTime" label="每日结束时间" width="180">
      </el-table-column>
      <el-table-column prop="count" label="商品数量" width="180">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <a href="javascript:;" @click="goodsList(scope.row)">商品列表</a>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      titleName: this.$route.query.name,
      setData: []
    }
  },
  methods: {
    //   商品列表
    goodsList(scp) {
      console.log(1)
      this.$router.history.push(
        `/goods-lists?name=商品列表&activeId=${this.$route.query.id}&activeTimeId=${scp.id}`
      )
    },
    // 获取当前id请求来的参数
    async getIdParams() {
      console.log(this.$route.query.id)
      const { data: res } = await this.$http.get(
        '/ActiveController/findGoodsCount',
        {
          params: {
            activeId: parseInt(this.$route.query.id)
          }
        }
      )
      console.log(res, 'aabc')
      if (res.Flag !== true) {
        return this.$Toast('查询失败', 'error')
      }
      this.$Toast('查询成功', 'success')
      this.setData = res.data
    }
  },
  created() {
    this.getIdParams()
  }
}
</script>

<style lang="less"></style>
